package com.lindroy.androidplayer.viewmodels

import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.viewModelScope
import androidx.paging.cachedIn
import com.lindroy.androidplayer.logic.network.repository.Repository
import com.lindroy.androidplayer.utils.mapArticleData
import com.lindroy.androidplayer.utils.mapSingle

/**
 * @author Lin
 * @date 2022/1/26
 * @function
 */
class QuestionViewModel : PageViewModel() {
    private val itemClickAction = MutableLiveData<ArticleItemViewModel>()

    val itemClickLiveData = itemClickAction.mapSingle { it }

    fun getQuestionList() =
        Repository.questionList.mapArticleData(itemClickAction).cachedIn(viewModelScope)
}